﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BusinessObjects.BO_GetObjects;
using LibraryO2S;

public partial class Pages_ListNews : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadData();
        }
    }

    protected void loadData()
    {
        DataTable objDT = BO_Articles.SelectByCategory(1, 1, 12);
        int page_size = 12;//Convert.ToInt32(paze_size);
        int cur_page = Convert.ToInt32(Request["cur_page"]);
        if (cur_page == 0)
            cur_page = 1;
        string url = Request.Url.AbsoluteUri;
        if (url.IndexOf("&cur_page") > 0)
        {
            url = url.Remove(url.IndexOf("&cur_page"));
        }

        url += "&cur_page=$CUR_PAGE";
        if (objDT.Rows.Count > 0)
        {
            pagerContainer.InnerHtml = O2S_Pager.Paging(page_size, cur_page, Convert.ToInt32(objDT.Rows[0]["row_count"]), url);
        }
        rptNews.DataSource = objDT;
        rptNews.DataBind();
    }

    protected void loadRelative()
    {

    }

}